package cn.com.dcsgo.design.pattern.factory.abstractt;

/**
 * 主机
 *
 * @author Dcsgo
 * @since 8/6/2025 下午 8:18
 */

public class Mainframe implements MainframeFactory {
    private CentralProcessingUnit cpu;
    private Memory memory;
    private Motherboard motherboard;
    private PowerSupply powerSupply;

    @Override
    public CentralProcessingUnit getCentralProcessingUnit() {
        cpu = new CentralProcessingUnit();
        return cpu;
    }

    @Override
    public Memory getMemory() {
        memory = new Memory();
        return memory;
    }

    @Override
    public Motherboard getMotherboard() {
        motherboard = new Motherboard();
        return motherboard;
    }

    @Override
    public PowerSupply getPowerSupply() {
        powerSupply = new PowerSupply();
        return powerSupply;
    }

    @Override
    public void make() {
        cpu.make();
        motherboard.make();
        memory.make();
        powerSupply.make();
        System.out.println("主机生产完成");
    }
}
